#include "symbolTable/Variable.h"

UniAST::Variable::Variable(std::shared_ptr<UniAST::Type> varType, std::string name,
                           mlir::Value mlirvalue, bool defined)
    : varType(varType), name(name), allocavalue(mlirvalue),
      defined(defined)
{
}

void UniAST::Variable::setType(std::shared_ptr<UniAST::Type> ty)
{
    this->varType = ty;
}

std::shared_ptr<UniAST::Type> UniAST::Variable::getType()
{
    return this->varType;
}

std::string UniAST::Variable::getName()
{
    return this->name;
}

mlir::Value UniAST::Variable::getValue()
{
    return this->allocavalue;
}

void UniAST::Variable::setValue(mlir::Value mlirvalue)
{
    this->allocavalue = mlirvalue;
}

std::shared_ptr<UniAST::Variable>
UniAST::Variable::get(std::string name, std::shared_ptr<UniAST::Type> varType,
                      mlir::Value mlirvalue, bool defined)
{
    return std::make_shared<Variable>(varType, name, mlirvalue, defined);
}